package com.cgc.shop.service.impl;

import org.springframework.stereotype.Service;

import com.cgc.shop.model.Cart;
import com.cgc.shop.model.Orders;
import com.cgc.shop.service.CartService;

@Service("cartService")
public class CartServiceImpl extends BaseServiceImpl<Cart> implements CartService {
	@Override
	public Double calculateTotal(Cart cart) {
		Double total = 0.0;
		for (Orders orders : cart.getOrderses()) {
			total = total + orders.getPrice() * orders.getNumber();
		}
		return total;
	}
}
